#pragma once
#include "StdAfx.h"

class ShaderDesc
	:public GameResourceDesc
{
};
class Actor;
class Camera;
class Shader :
	public GameResource
{
public:
	Shader(GameResourceDesc &desc):GameResource(desc){};
	Shader(ShaderDesc&);
	~Shader(void);
	//the parameters that are going to be loaded before the pass
	sptr<Actor> LightActor;
	sptr<Camera> MainCamera;
	Vec3 Translation, Scale;
	Quat Rotation;

	void UseTechnique(string);
	void BeginPass(string);
	void EndPass();
	void SetReal(string, real);
	void SetVec2(string, Vec2);
	void SetVec3(string, Vec3);
	void SetVec4(string, Vec4);
	void SetMat44(string, Mat44);
	void LoadMaterial(sptr<GameResource>);
	void LoadTexture(string, sptr<GameResource>);
	void UnloadTexture(string);
	
	CGparameter GetParam(string);
	CGeffect GetEffect();
	virtual void LoadFromFile();
	virtual void SaveToFile();
private:
	CGeffect Effect;
	CGtechnique Technique;
	CGpass Pass;
	
	void LoadTransforms();
	void LoadWorld();
	void LoadView();
	void LoadViewProj();
	void LoadLight(sptr<Actor>);
	void LoadWorldViewProj();
};

